setTextBackgroundColor

abstract fun setTextBackgroundColor(block: DesignBlock, color: Color, from: Int = -1, to: Int = -1)

Changes the background color of the text in the selected range to the given color. The background is drawn as a rectangle behind each affected text run, or as a band along the curve for text on a path. A fully transparent color removes the background from the range. The run background is independent of the block-level background color ("backgroundColor/color"); it is drawn on top of the block-level background. Required scope: "fill/change"

Parameters

block

the text block whose background color should be changed.

color

the new background color of the selected text range.

from

the start index of the range whose background color should be changed. If the value is negative and the block is currently being edited, this will fall back to the start of the current cursor index / selected range. If the value is negative and the block is not being edited, this will fall back to the start of the entire text range.

to

the index after the last character whose background color should be changed. If the value is negative and the block is currently being edited, this will fall back to the end of the current cursor index / selected range. If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.